const useAppStore = defineStore(
  'app',
  {
    state() {
      return{
        device: 'desktop',  //  mobile/desktop
        sidebar: {
          opened: localStorage.getItem('sidebarStatus') ? !!+localStorage.getItem('sidebarStatus') : true,
        }
      }
    },
    actions:{
      /**
       * device 左侧菜单宽度切换
       * @param device
       */
      toggleDevice(device: 'mobile' | "desktop") {
        this.device = device
      },
      /**
       * 切换 SideBar 形态
       */
      toggleSideBar(){
        this.sidebar.opened = !this.sidebar.opened
      }
    }
  }
)

export { useAppStore } ;